Skip to content

Fix client authoritive NetworkAnimator#2115

Closed
florius0 wants to merge 4 commits intoUnity-Technologies:developfrom
Ninsar:develop
Closed

Fix client authoritive NetworkAnimator#2115
florius0 wants to merge 4 commits intoUnity-Technologies:developfrom
Ninsar:develop

Conversation

@florius0
Copy link
Copy Markdown

When synchronising Animator with NetworkAnimator component the second client (if number of clients is greater than 2) was not synchronised when IsServerAuthoritive() is false.

Changelog

  • Fixed: NetworkAnimator was not synced correctly for second client when not server-authoritive.

Testing and Documentation

  • No tests have been added.
  • No documentation changes or additions were necessary.

Vadim Tsvetkov and others added 2 commits August 11, 2022 00:40
сo-authored: Andrei Soprachev <SoprachevAK@users.noreply.github.com>
@florius0 florius0 requested a review from a team as a code owner August 11, 2022 15:48
@unity-cla-assistant
Copy link
Copy Markdown

unity-cla-assistant commented Aug 11, 2022

CLA assistant check
All committers have signed the CLA.

@florius0 florius0 changed the title Fix NetworkAnimator Fix client authoritive NetworkAnimator Aug 11, 2022
}
UpdateParameters(parametersUpdate);
if (NetworkManager.ConnectedClientsIds.Count - 2 > 0)
if (IsHost && NetworkManager.ConnectedClientsIds.Count > 2 || NetworkManager.ConnectedClientsIds.Count > 1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see...yes that is a good catch indeed!
How about we condense that to something like:

                if (NetworkManager.ConnectedClientsIds.Count > (IsHost ? 2 : 1) )
                {

Thank you for your contribution and taking the time to troubleshoot that! 👍

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do, but isn't it more clear as it is?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well...with your current suggested fix you could still have a Host with one connected client and it would pass the conditional "If" check. My update to your suggestion assures that if it is a Host it requires more than 2 connected clients, otherwise if it is server it only requires one.
Does that make sense?

Copy link
Copy Markdown
Author

@florius0 florius0 Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we overlooked it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@NoelStephensUnity
Copy link
Copy Markdown
Member

This PR was brought into the build pipeline via PR-2127. Closing this PR now that it has been processed internally.

@NoelStephensUnity
Copy link
Copy Markdown
Member

NoelStephensUnity commented Aug 18, 2022

@florius0
I found some other issues that prevented the PR from making it into the coming patch.
If you are blocked, you can always use the fix/client-authoritative-networkanimator branch until it is merged.
There is an edge case (or less frequent) scenario I need to make some adjustments for on that branch. So, unless you set multiple triggers at the same time on the same Animator that start multiple transition states it should work fine. 👍

@florius0
Copy link
Copy Markdown
Author

Thank you. We are currently using our fork cherry-picked on v1.0.0 and we'll watch for it in our project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants